use std::collections::HashMap;

fn main() {
    let mut scores = HashMap::new();
    scores.insert(String::from("Melody"), 143);
    println!("{:?}", scores);

    // 通过tuple的vector构建hashmap
    let teams = vec![String::from("Blue"), String::from("Yellow")];
    let scores = vec![120, 130];
    // 1. 下面必须指定类型
    // 2. 通过 zip() 进行“拉链”
    // 3. 通过collect()构建HashMap
    let hm: HashMap<_, _> = teams.iter().zip(scores.iter()).collect();
    println!("{:?}", hm);
}